package com.eastfair.config.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.eastfair.core.base.entity.Entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.eastfair.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;
import com.eastfair.annotation.model.EchoVO;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 附件资源管理
 * </p>
 *
 * @author zjn
 * @since 2021-12-02
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("c_attachment")
@ApiModel(value = "Attachment", description = "附件资源管理")
@AllArgsConstructor
public class Attachment extends Entity<Long> implements EchoVO {

    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    private Map<String, Object> echoMap = new HashMap<>();
    /**
     * 项目id
     */
    @ApiModelProperty(value = "项目id")
    @TableField(value = "project_id")
    @Excel(name = "项目id")
    private Long projectId;

    /**
     * 文件名称
     */
    @ApiModelProperty(value = "文件名称")
    @Size(max = 256, message = "文件名称长度不能超过256")
    @TableField(value = "file_name", condition = LIKE)
    @Excel(name = "文件名称")
    private String fileName;

    /**
     * 附件地址
     */
    @ApiModelProperty(value = "附件地址")
    @Size(max = 256, message = "附件地址长度不能超过256")
    @TableField(value = "file_url", condition = LIKE)
    @Excel(name = "附件地址")
    private String fileUrl;

    /**
     * 附件类型
     */
    @ApiModelProperty(value = "附件类型")
    @Size(max = 32, message = "附件类型长度不能超过32")
    @TableField(value = "file_type", condition = LIKE)
    @Excel(name = "附件类型")
    private String fileType;

    /**
     * 业务类型
     */
    @ApiModelProperty(value = "业务类型")
    @Size(max = 32, message = "业务类型长度不能超过32")
    @TableField(value = "business_type", condition = LIKE)
    @Excel(name = "业务类型")
    private String businessType;

    /**
     * 业务id
     */
    @ApiModelProperty(value = "业务id")
    @TableField(value = "business_id")
    @Excel(name = "业务id")
    private Long businessId;

    /**
     * 排序
     */
    @ApiModelProperty(value = "排序")
    @TableField(value = "sequence")
    @Excel(name = "排序")
    private Integer sequence;

    /**
     * 是否启用：1是；0否
     */
    @ApiModelProperty(value = "是否启用：1是；0否")
    @TableField(value = "is_enable")
    @Excel(name = "是否启用：1是；0否")
    private Integer isEnable;

    /**
     * 是否删除：1是；0否
     */
    @ApiModelProperty(value = "是否删除：1是；0否")
    @TableField(value = "is_delete")
    @Excel(name = "是否删除：1是；0否")
    private Integer isDelete;


    @Builder
    public Attachment(Long id, Long createdBy, LocalDateTime createTime, Long updatedBy, LocalDateTime updateTime, 
                    Long projectId, String fileName, String fileUrl, String fileType, String businessType, 
                    Long businessId, Integer sequence, Integer isEnable, Integer isDelete) {
        this.id = id;
        this.createdBy = createdBy;
        this.createTime = createTime;
        this.updatedBy = updatedBy;
        this.updateTime = updateTime;
        this.projectId = projectId;
        this.fileName = fileName;
        this.fileUrl = fileUrl;
        this.fileType = fileType;
        this.businessType = businessType;
        this.businessId = businessId;
        this.sequence = sequence;
        this.isEnable = isEnable;
        this.isDelete = isDelete;
    }

}
